import React from 'react'
import PropTypes from 'prop-types'
import './IconFont.scss'

function IconFont({ type, className, color }) {
  const iconClass = `iconfont icon-${type}`
  const style = { color }

  return (
    <span
      className={className}
      styleName="wrapper"
      style={style}
    >
      <i className={iconClass} />
    </span>
  )
}

IconFont.propTypes = {
  type: PropTypes.string.isRequired,
  color: PropTypes.string.isRequired,
  className: PropTypes.string,
}

IconFont.defaultProps = {
  className: '',
  color: 'inherit',
}

export default IconFont
